<template>
  <el-dialog v-model="modelValue" title="这是标题" width="30%" @close="closeDialog">
    <span>This is a message</span>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="closeDialog">Cancel</el-button>
        <el-button type="primary" @click="closeDialog">Confirm</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup>
defineProps({
  modelValue: {
    // 父组件v-model没有指定参数名，则默认是modelValue
    type: Boolean,
    default: false,
  },
})
const emit = defineEmits(['update:modelValue'])
const closeDialog = () => {
  emit('update:modelValue', false)
}
</script>

<!--
<script>
export default{
  name: 'DialogVmodel',
  props:{
    modelValue:{
      // 父组件v-model没有指定参数名，则默认是modelValue
      type: Boolean,
      default: false,
    },
  },
  setup(props, ctx){
    const closeDialog=()=>{
      ctx.emit('update:modelValue',false)
    }
    return{
      closeDialog,
    }
  },
}
</script>
-->

<style scoped></style>
